package Demo3;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1 = in.nextInt();
        int n2 = in.nextInt();
        // 遍历
        if(n1 % 2 != 0) n1++;
        int count = 0;
        for(int i = n1; i <= n2; i++) {
            count += fun(i);
        }
        System.out.println(count);
    }

    private static int fun(int num) {
        int ret = 0;
        while(num > 0) {
            if(num % 10 == 2) {
                ret++;
            }
            num /= 10;
        }
        return ret;
    }
}